package com.yygo.service.impl;

import com.yygo.dao.CityDao;
import com.yygo.model.City;
import com.yygo.model.County;
import com.yygo.service.CityManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by tiansha on 2015/6/24.
 */
@Service("cityManager")
public class CityManagerImpl extends GenericManagerImpl<City, Long> implements CityManager {

    private CityDao cityDao;

    @Autowired
    public CityManagerImpl(CityDao cityDao) {
        super(cityDao);
        this.cityDao = cityDao;
    }

    @Override
    @Cacheable(value = "cityCounties", key = "#cityName")
    public List<County> getMyCounty(String cityName) {
        return cityDao.findByCityName(cityName);
    }

}
